// import Vue from "vue";
// import VueRouter from "vue-router";
import { createRouter, createWebHistory } from 'vue-router'; // 使用 Vue Router 4 新的导入方式
import Login from "../components/loginComponent.vue";
import Home from "../views/home.vue";

// vue2的功能
// Vue.use(VueRouter);

// 路由名必须是多单词组成
const routes = [
  {
    path: "/",
    name: "HomeView",
    component: Home,
  },
  {
    path: "/login",
    name: "LoginView",
    component: Login,
  },
];

const router = createRouter({
  history: createWebHistory(),
  base: process.env.BASE_URL,
  routes
});

// vue2的功能
// const router = new VueRouter({
//   mode: "history",
//   base: process.env.BASE_URL,
//   routes,
// });

export default router;
